/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rw.magallanes.ide.action;

import com.rw.magallanes.ide.commons.search.SearchDialog;
import com.rw.magallanes.ide.main.MainFrame;
import com.rw.magallanes.ide.main.MainSystem;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.KeyStroke;

/**
 *
 * @author Gonzalez
 */
public class SearchAction extends AbstractAction {

    @Override
    public void actionPerformed(ActionEvent e) {
        MainSystem ms = MainSystem.getInstance();
        MainFrame mf = ms.getMainFrame();
        mf.stopEditingItemsTable();

        SearchDialog dialog = new SearchDialog(mf);
        dialog.showMe();
    }

    @Override
    public Object getValue(String key) {
        if (key.compareTo(NAME) == 0) {
            return "Buscar";
        } else if (key.compareTo(ACTION_COMMAND_KEY) == 0) {
            return "search";
        } else if (key.compareTo(ACCELERATOR_KEY) == 0) {
            return KeyStroke.getKeyStroke("ctrl F");
        } else {
            return super.getValue(key);
        }
    }
}
